package mapping;

/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2020-01-04 18:02
 * @notify 每个SqlSource有多个SqlNode，而DynamicContext负责将多个sqlNode解析出来的sql信息拼接到一块
 * @version 1.0
 */
public class DynamicContext {
    //多个sqlNode调用自己的apply（）都把解析好的sql放到这里。
    private StringBuilder sb = new StringBuilder();
    //sql入参
    private Object param;

    public String getSql() {
        return sb.toString();
    }

    public DynamicContext(Object param) {
        this.param = param;
    }

    public void appendSql(String sqlText) {
        sb.append(sqlText);
        sb.append(" ");
    }

    public Object getParam() {
        return param;
    }

}
